#ifndef _STACKFRAME_HPP
#define _STACKFRAME_HPP

#include "ClosureFunction.hpp"

using namespace object;

class StackFrame {
public:
	StackFrame(ClosureFunction* cf, int base = 0) 
		: _cf(cf)
		, _base(base) {
	}

	std::vector<int>& getIns() const { 
		return _cf->getFn()->getIns();
	}

	int getIp() const { return _ip; }

	void incrIp() { _ip++; }

	void setIp(int ip) { _ip = ip; }

	int getBase() const { return _base; }

private:
	int _base{ 0 };
	int _ip{ -1 };
	ClosureFunction* _cf{ nullptr };
};

#endif // !_STACKFRAME_HPP
